import request from '@/common/request/request.js'
import config from '@/common/config/config.js';
const http = config.env
import store from '@/common/store/index.js'

//检查是否展示引导页
export const checkGuidePage = () => {
	return request({
		url: http.baseUrl + '/api/module/guide/list',
		method: 'get',
	})
}
//完成引导页查看
export const finishGuidePage = () => {
	return request({
		url: http.baseUrl + '/api/module/guide/save',
		method: 'post',
	})
}

//看广告 当月任务情况 (判断是否解锁看广告领积分)
export const getMonthTask = () => {
	return request({
		url: http.baseUrl + '/checkAds/monthTask',
		method: 'get'
	})
}
//看广告任务日历
export const getListByDay = data => {
	return request({
		url: http.baseUrl + '/checkAds/listByDay',
		method: 'get',
		data: data
	})
}
// 视频列表
export const getVideoList = data => {
	return request({
		url: http.baseUrl + '/api/video/getVideoList',
		method: 'get',
		data: data
	})
}
// 看广告总天数和获得广告积分总数
export const getTotal = data => {
	return request({
		url: http.baseUrl + '/checkAds/sum',
		method: 'get',
		data: data
	})
}

// 观看完视频请求接口
export const sign = (data) => {
	return request({
		url: http.baseUrl + `/checkAds/sign`,
		method: 'get',
		data: data
	})
}

// 视频列表
export const taskProgress = (data) => {
	return request({
		url: http.baseUrl + `/checkAds/taskProgress`,
		method: 'get',
		data: data
	})
}

// 签到记录
export const signList = () => {
	return request({
		url: http.ycUrl + `/customer/checkAds/list`,
		method: 'get',
		header:{
			authorization: store.state.ycToken,
			tenant: 'adkjfhjkwqebrjg',
			notToken: true
		}
	})
}
// 广告规则
export const checkAdsSetting = () => {
	return request({
		url: http.baseUrl + `/checkAds/setting`,
		method: 'get'
	})
}

// 视频详情
export const getVideoDetail = id => {
	return request({
		url: http.ycUrl + `/customer/video/main/${id}`,
		method: 'get',
		header:{
			authorization: store.state.ycToken,
			tenant: 'adkjfhjkwqebrjg',
			notToken: true
		}
	})
}
// 广告收益
export const checkAdsAccount = () => {
	return request({
		url: http.baseUrl + `/checkAds/myAccount`,
		method: 'get'
	})
}

// 广告积分行权
export const transferToTr = (data) => {
	return request({
		url: `${http.baseUrl}/checkAds/transferToTr?amount=${data}`,
		method: 'post',
	})
}

// 广告积分行权比例
export const transferToTrRate = () => {
	return request({
		url: http.baseUrl + `/checkAds/transferToTrRate`,
		method: 'get'
	})
}